import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// 按需引入
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
// 按需引入 element-plus
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// 按需引入 Naive-Ui
// import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' 

export default defineConfig({
  // ...
  plugins: [
    vue(),
    // ...
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  base:'/vue3_todo-app/',
  // server:{
  //   port:5999
  // }
})
